package avicit.bdp.dms.das.rest;

import avicit.bdp.common.service.dto.BdpTableHistoryDTO;
import avicit.bdp.dms.das.service.BdpDasTableHistoryService;
import avicit.platform6.core.rest.msg.QueryRespBean;
import avicit.platform6.core.rest.msg.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 逻辑模型版本REST接口
 */
@RestController
@Api(tags = "逻辑模型版本REST接口")
@RequestMapping("/api/bdp/dms/das/tableHistory")
public class BdpDasTableHistoryRest {

 @Autowired
 private BdpDasTableHistoryService tableHistoryService;

 @ApiOperation(value = "逻辑模型版本列表")
 @ApiImplicitParams({
         @ApiImplicitParam(value = "模型id", name = "tableId", dataType = "String"),
         @ApiImplicitParam(value = "查询关键字", name = "keyWords", dataType = "String"),
         @ApiImplicitParam(value = "当前页", name = "pageNo", dataType = "Integer"),
         @ApiImplicitParam(value = "每页大小", name = "pageSize", dataType = "Integer")
 })
 @GetMapping("/getPageList")
 public ResponseMsg<QueryRespBean<BdpTableHistoryDTO>> getPageList(
         @RequestParam String tableId,
         @RequestParam(required = false) String keyWords,
         @RequestParam(defaultValue = "1", required = false) Integer pageNo,
         @RequestParam(defaultValue = "10", required = false) Integer pageSize) {
  ResponseMsg<QueryRespBean<BdpTableHistoryDTO>> responseMsg = new ResponseMsg<>();

  responseMsg.setResponseBody(tableHistoryService.getPageList(tableId, keyWords, pageNo, pageSize));

  return responseMsg;
 }
}
